<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:include="shared/css_js::header">
	<title>jQuery WeUI</title>
	<link rel="stylesheet" type="text/css" href="/static/css/weuicss/weui.min.css"/>
</head>
<style>
	 .weui-cells:before {
		content: " ";
		position: absolute;
		left: 0;
		right: 0;
		height: 1px;
		color: #e5e5e5;
		z-index: 2;
	}
	 .weui-cells:before {
		 top: 0;
		 border-top: 1px solid #e5e5e5;
		 -webkit-transform-origin: 0 0;
		 transform-origin: 0 0;
		 -webkit-transform: scaleY(.5);
		 transform: scaleY(.5);
	 }
	 .weui-cells:after {
		 bottom: 0;
		 border-bottom: 1px solid #e5e5e5;
		 -webkit-transform-origin: 0 100%;
		 transform-origin: 0 100%;
		 -webkit-transform: scaleY(.5);
		 transform: scaleY(.5);
	 }
	 .weui-cell_access .weui-cell__bd::after {
		   content: " ";
		   display: inline-block;
		   height: 6px;
		   width: 6px;
		   transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0);
		   position: absolute;
		   top: 50%;
		   margin-top: -4px;
		   margin-right: 10px;
		   right: 2px;
		   border-width: 2px 2px 0px 0px;
		   border-color: rgb(200, 200, 205);
		   border-style: solid;
	   }
	 .weui-cell {
		 padding: 5px 15px;
	 }
</style>
<body>


<header class="mui-bar mui-bar-nav">
	<a onclick="exithome()" class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
	<h1 class="mui-title"><font size="4"><b>个人信息</b></font></h1>
</header>

<div class="mui-content">
	<div class="weui-cells" style="margin-top: 0px">
		<div class="weui-cell">
			<div class="weui-cell__hd"><label  class="weui-label">真实姓名</label></div>
			<div class="weui-cell__bd">
				<input class="weui-input" th:value="${custinfo.custname}" onchange="savecustname()" id="custname" type="text" style="border: 0px;margin-bottom: 0px" placeholder="请输入"/>
			</div>
		</div>
		<div class="weui-cell">
			<div class="weui-cell__hd"><label  class="weui-label">手机号</label></div>
			<div class="weui-cell__bd">
				<input class="weui-input" th:value="${custinfo.mobile}" onchange="savemobile()" id="mobile" type="text" style="border: 0px;margin-bottom: 0px" placeholder="请输入"/>
			</div>
		</div>
		<div class="weui-cell">
			<div class="weui-cell__hd"><label  class="weui-label">性别</label></div>
			<div class="weui-cell__bd">
				<input class="weui-input" th:value="${custinfo.fm}" id="sex" type="text" style="border: 0px;margin-bottom: 0px" placeholder="请点击选择"/>
			</div>
		</div>
		<div class="weui-cell">
			<div class="weui-cell__hd"><label  class="weui-label">生日</label></div>
			<div class="weui-cell__bd">
				<input class="weui-input" th:value="${custinfo.custbirthday}" id="custbirthday" type="text" style="border: 0px;margin-bottom: 0px" placeholder="请输入"/>
			</div>
		</div>
		<div class="weui-cell">
			<div class="weui-cell__hd"><label  class="weui-label">地址</label></div>
			<div class="weui-cell__bd">
				<input class="weui-input" th:value="${custinfo.addr}" id="addr" type="text" style="border: 0px;margin-bottom: 0px" placeholder="请输入" />
			</div>
		</div>
		<div class="weui-cell">
			<div class="weui-cell__hd"><label  class="weui-label">会员等级</label></div>
			<div class="weui-cell__bd">
				<input class="weui-input" th:value="${custinfo.custlevel}" id="custlevel" type="text" style="border: 0px;margin-bottom: 0px" readonly="readonly"/>
			</div>
		</div>
		<div class="weui-cell">
			<div class="weui-cell__hd"><label  class="weui-label">Email</label></div>
			<div class="weui-cell__bd">
				<input class="weui-input" th:value="${custinfo.email}" onchange="saveemail()" id="email" type="text" style="border: 0px;margin-bottom: 0px" placeholder="请输入" />
			</div>
		</div>
		<div class="weui-cell">
			<div class="weui-cell__hd"><label  class="weui-label">月收入</label></div>
			<div class="weui-cell__bd">
				<input class="weui-input" th:value="${custinfo.income}" onchange="saveincome()" id="income" type="text" style="border: 0px;margin-bottom: 0px" placeholder="请输入" />
			</div>
		</div>
		<div class="weui-cell">
			<div class="weui-cell__hd"><label  class="weui-label">身份证号</label></div>
			<div class="weui-cell__bd">
				<input class="weui-input" th:value="${custinfo.idnum}" onchange="saveidnum()" id="idnum" type="text" style="border: 0px;margin-bottom: 0px" placeholder="请输入" />
			</div>
		</div>
		<div class="weui-cell">
			<div class="weui-cell__hd"><label  class="weui-label">微信绑定</label></div>
			<div class="weui-cell__bd">
				<input class="weui-input" th:if="${custinfo.wxid!=''}" th:value="绑定" id="wxid" type="text" style="border: 0px;margin-bottom: 0px" placeholder="请点击选择"/>
				<input class="weui-input" th:if="${custinfo.wxid==''}" th:value="解绑" id="wxid" type="text" style="border: 0px;margin-bottom: 0px" placeholder="请点击选择"/>
			</div>
		</div>
	</div>
</div>
<!--<script src="https://cdn.bootcss.com/jquery-weui/1.2.0/js/city-picker.min.js"></script>-->
<script th:src="@{/js/weuijs/city-picker.js}" type="text/javascript"></script>
<script>
	/*返回到首页*/
	function exithome() {
		location.href="/person/personhome";
    }
    $("#sex").select({
        title: "选择性别",
        items: [
            {
                title: "男",
                value: "1",
            },
            {
                title: "女",
                value: "0",
            }
        ],
         onClose:function () {
             var sex=$("#sex").val();
             mui.ajax('/person/savesex',{
                 data:{
                     sex:sex
                 },
                 type:'get',//HTTP请求类型
                 success:function(data){
                     if(data=='success'){
                         $.toptip('更新成功', 'success');
                     }else {
                         $.toptip('服务器出问题啦', 'error');
                     }
                 }
             })
       }
    });
    $("#wxid").select({
        title: "请选择",
        items: [
            {
                title: "绑定",
                value: "1",
            },
            {
                title: "解绑",
                value: "0",
            }
        ],
        onClose:function () {
            var wxid=$("#wxid").val();
            mui.ajax('/person/saveOrdelwxid',{
                data:{
                    wxid:wxid
                },
                type:'get',//HTTP请求类型
                success:function(data){
                    if(data=='success'){
                        $.toptip('更新成功', 'success');
                    }else {
                        $.toptip('服务器出问题啦', 'error');
                    }
                }
            })
        }
    });
    //客户生日日期选择器
    $("#custbirthday").calendar({
        dateFormat:"yyyy-mm-dd",
        onClose:function () {
            var custbirthday=$("#custbirthday").val();
            mui.ajax('/person/savecustbirthday',{
                data:{
                    custbirthday:custbirthday
                },
                type:'get',//HTTP请求类型
                success:function(data){
                    if(data=='success'){
                        $.toptip('更新成功', 'success');
                    }else {
                        $.toptip('服务器出问题啦', 'error');
                    }
                }
            })
        }
    });
    /*选择城市*/
    $("#addr").cityPicker({
        title: "请选择所在城市",
        onClose:function () {
            var regionid=$("#addr").val();
            mui.ajax('/person/saveaddr',{
                data:{
                    regionid:regionid
                },
                type:'get',//HTTP请求类型
                success:function(data){
                    if(data=='success'){
                        $.toptip('更新成功', 'success');
                    }else {
                        $.toptip('操作失败', 'error');
                    }
                }
            })
        }
    });
    /*输入真实姓名ajax存储*/
    function savecustname() {
        var custname=$("#custname").val();
        mui.ajax('/person/savecustname',{
            data:{
                custname:custname
            },
            type:'get',//HTTP请求类型
            success:function(data){
                if(data=='success'){
                    $.toptip('更新成功', 'success');
                }else {
                    $.toptip('操作失败', 'error');
                }
            }
        })
    }
    /*输入手机号ajax存储*/
    function savemobile() {
        var mobile=$("#mobile").val();
        mui.ajax('/person/savemobile',{
            data:{
                mobile:mobile
            },
            type:'get',//HTTP请求类型
            success:function(data){
                if(data=='success'){
                    $.toptip('更新成功', 'success');
                }else {
                    $.toptip('服务器出问题啦', 'error');
                }
            }
        })
    }
    /*输入Email ajax存储*/
    function saveemail() {
        var email=$("#email").val();
        mui.ajax('/person/saveemail',{
            data:{
                email:email
            },
            type:'get',//HTTP请求类型
            success:function(data){
                if(data=='success'){
                    $.toptip('更新成功', 'success');
                }else {
                    $.toptip('服务器出问题啦', 'error');
                }
            }
        })
    }
    /*输入月收入 ajax存储*/
    function saveincome() {
        var income=$("#income").val();
        mui.ajax('/person/saveincome',{
            data:{
                income:income
            },
            type:'get',//HTTP请求类型
            success:function(data){
                if(data=='success'){
                    $.toptip('更新成功', 'success');
                }else {
                    $.toptip('服务器出问题啦', 'error');
                }
            }
        })
    }
    /*输入身份证号ajax存储*/
    function saveidnum() {
        var idnum=$("#idnum").val();
        mui.ajax('/person/saveidnum',{
            data:{
                idnum:idnum
            },
            type:'get',//HTTP请求类型
            success:function(data){
                if(data=='success'){
                    $.toptip('更新成功', 'success');
                }else {
                    $.toptip('服务器出问题啦', 'error');
                }
            }
        })
    }
</script>
</body>
</html>
